package org.benjamin.lending.controller;

import javax.validation.Valid;

import org.benjamin.lending.domain.ReplaceBankForm;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;


/**
 * 前端页面用户展示了，用户绑定的银行卡。
 * 提交申请取消银行卡绑定
 * @author 黄文杰
 *
 */
@Controller
@RequestMapping(value = "bank")
public class BankController {
	
	@GetMapping(value = "replaceBankCard")
	public String toReplaceBankCard(){
		return "bank.replace";
	}
	
	@PostMapping(value = "replaceBankCard")
	public String doReplaceBanlCard(@Valid ReplaceBankForm replaceBankForm,BindingResult bindingResult){
		if(!bindingResult.hasErrors()){
			
			return "account.success";	
		}
		return "account.success";
	}

}
